/**
 * Copyright (c) 2010-2011 Pierre LABATUT
 *
 * This file is part of multiple-track-player project.
 *
 * multiple-track-player is free software: you can redistribute it and/or modify it
 * under the terms of its license which may be found in the accompanying
 * LICENSE file or <http://code.google.com/p/multiple-track-player/>.
 */
package multitrack.preload;

import java.awt.Graphics;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JToggleButton;

/**
 * Push button with customized draw. The button border and focus is not drawn.
 * The component visual is made of getSelectedIcon() or getIcon() according to 
 * the selection state.
 * 
 * @author Pierre LABATUT
 */
public class ImagePushButton extends JToggleButton {

    public ImagePushButton(String text, Icon icon, boolean selected) {
        super(text, icon, selected);
    }

    public ImagePushButton(String text, Icon icon) {
        super(text, icon);
    }

    public ImagePushButton(Action a) {
        super(a);
    }

    public ImagePushButton(String text, boolean selected) {
        super(text, selected);
    }

    public ImagePushButton(String text) {
        super(text);
    }

    public ImagePushButton(Icon icon, boolean selected) {
        super(icon, selected);
    }

    public ImagePushButton(Icon icon) {
        super(icon);
    }

    public ImagePushButton() {
    }

    @Override
    public void paint(Graphics g) {

        final Icon icon = isSelected() ? getSelectedIcon() : getIcon();
        icon.paintIcon(this, g, 0, 0);

    }
}
